import Vue from 'vue'
import Spin from './Spin'
import Modal from './Modal'
import Toast from './Toast'


// 日期选择组件 
import Input from './Input'
import Button from './Button'
import Header from './TopHeader'
import SideMenu from './SideMenu'


const components = {
  'input': Input,
  'form-group': Input.group,
  'form-validate': Input.validate,
  'switch': Input.switch,
  'label': Input.label,
  'button': Button,
  'button-group': Button.ButtonGroup,
  'button-timer': Button.ButtonTimer,
  'header': Header,
  'side-menu': SideMenu
}

Vue.use({
  install: Vue => {
    Object.keys(components).forEach(key => {
      Vue.component(`w-${key}`, components[key])
    })

    Vue.prototype.$spin = window.$spin = Spin
    Vue.prototype.$modal = window.$modal = Modal
    Vue.prototype.$toast = window.$toast = Toast
  }
})